#!/bin/sh
INFILE=$1
echo $INFILE
OUTFILE=$(basename "$1" .flac).mp3
DIRNAME=$(dirname "$1"|sed -e 's/flac/mp3/g')  
echo $DIRNAME/$OUTFILE

if [ ! -d "$DIRNAME" ]; then
	mkdir -p "$DIRNAME"
fi

if [ ! -z "$1" ]; then
	ffmpeg -i "$INFILE" -qscale:a 7 "$DIRNAME/$OUTFILE"
fi
